<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" :width="1000" :close-on-press-escape="mode != 'show' ? false : true" destroy-on-close @closed="$emit('closed')" :close-on-click-modal="false">
        <el-container>
            <el-main class="nopadding"> 
                <scTable ref="table" :apiObj="apiObj" row-key="id" border @setExtend="setExtend" height="500" :params="query">
                    <el-table-column type="selection" width="50" align="center"></el-table-column>
                    <el-table-column label="条码" prop="roll_code" align="center"></el-table-column>
                    <el-table-column label="花型" prop="flower" align="center"></el-table-column>
                    <el-table-column label="颜色" prop="color" align="center"></el-table-column>
                    <el-table-column label="库存" prop="curr_stock" align="center"></el-table-column>
                </scTable>
            </el-main>
        </el-container>
		<template #footer>
			<el-button @click="visible = false">取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
    props:{
        query: { type: Object, default: () => ({}) },
    },
	emits: ['success', 'closed'],
	data() {
		return {
			mode: "add",
			titleMap: {
				add: '新增',
				edit: '编辑',
				show: '查看'
			},
			visible: false,
			apiObj: this.$API.ware.ware.stock_inspect.list,
            dialog: {
                purchase: false,
                dye: false,
                machin: false,
            },
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
        //搜索
		upsearch() {
			this.$refs.table.upData(this.search)
		},
        refresh() {
            for (const key in this.search) {
                this.search[key] = null;
            }
            this.$refs.table.upData(this.search)
        },
	}
}
</script>

<style></style>
